﻿@model Zatify.WebUI.Models.PromotionDetailsViewModel
@{
    ViewBag.Title = "Promotion Details";
    ViewBag.ContentTitle = "Promotion Details";
    Layout = "~/Views/Shared/_ContentLayout.cshtml";
}
@section Styles
{
    <style type="text/css">
        .inner_container
        {
            float: none;
        }
        .container
        {
            padding: 0px;
        }
    </style>
}
<div class="business_interface_area">
    <div style="position: relative;" class="business_profile_categories">
        <table cellspacing="0" cellpadding="0" border="0" class="promotion_tabe">
            <tbody>
                <tr>
                    <td width="200">
                        <span>Categories:</span>
                        <br />
                        <p>
                            $@Model.Promotion.BaseCostTimingFixedCost.ToString("0.00")/flat and $@Model.Promotion.BaseCostTimingRatePerPush.ToString("0.00")/push</p>
                    </td>
                    <td width="490" colspan="3">
                        @foreach (var category in Model.Promotion.Categories)
                        {
                            <div class="container">
                                @Html.CategoryBreadCrumbsSeparated(category, x => Url.Action("", ""))
                            </div>
                            <br />
                        }
                    </td>
                </tr>
                <tr>
                    <td>
                        <span>Proximity Radius</span>
                        <br />
                        <p>
                            $@Model.Promotion.PromixityRadiusFixedCost.ToString("0.00")/flat and $@Model.Promotion.PromixityRadiusRatePerPush.ToString("0.00")/push</p>
                    </td>
                    <td colspan="3">
                        @Model.SelectedRadiusText<br />
                        @if (Model.Promotion.RegisteredOutsideOfCity)
                        { 
                            <text>Registered Outside Of City</text>
                        }
                        else if (Model.Promotion.RegisteredOutsideOfState)
                        { 
                            <text>Registered Outside Of State</text>
                        }
                        else if (Model.Promotion.RegisteredOutsideOfZip)
                        { 
                            <text>Registered Outside Of ZIP</text>
                        }
                    </td>
                </tr>
                <tr>
                    <td>
                        <span>Timing</span>
                        <br />
                        <p>
                            $@Model.Promotion.CostTimingFixedCost.ToString("0.00")/flat and $@Model.Promotion.CostTimingRatePerPush.ToString("0.00")/push</p>
                    </td>
                    <td colspan="3">
                        @Model.SelectedTimingText
                    </td>
                </tr>
                <tr>
                    <td>
                        <span>Budget</span>
                    </td>
                    <td colspan="3">
                        @if (@Model.Promotion.CampaignBudget.HasValue)
                        {
                            <text>$</text>@Model.Promotion.CampaignBudget.Value.ToString("0.00");
                        }
                        else
                        {
                            <text>$0.00</text>
                        }
                    </td>
                </tr>
                <tr>
                    <td>
                        <span>Max Pushes</span>
                    </td>
                    <td colspan="3">
                        @Model.Promotion.MaxPushes
                    </td>
                </tr>
                @if (Model.Promotion.Status == Zatify.Domain.Data.PromotionStatus.Active)
                {
                    <text>
                    <tr>
                        <td colspan="4">
                            <span style="padding-left: 30px; font-size: 13px;">Spent:</span> $@Model.Promotion.SpentMoney.Value.ToString("0.00")
                            (@Model.Promotion.SpentPushes pushes)
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <span style="padding-left: 30px; font-size: 13px;">Unused:</span> $@Model.Promotion.UnusedMoney.Value.ToString("0.00")
                            (@Model.Promotion.UnusedPushes pushes)
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <span style="padding-left: 30px; font-size: 13px;">Check-Ins:</span> @(Model.Promotion.CheckIns ?? 0)
                        </td>
                    </tr>
                    </text>
                }
                else if (@Model.Promotion.Status == Zatify.Domain.Data.PromotionStatus.Complete)
                { 
                    <text>
                    <tr>
                        <td colspan="4">
                            <span style="padding-left: 30px; font-size: 13px;">Spent:</span> $@Model.Promotion.SpentMoney.Value.ToString("0.00")
                            (@Model.Promotion.SpentPushes pushes)
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <span style="padding-left: 30px; font-size: 13px;">Unused:</span> $@Model.Promotion.UnusedMoney.Value.ToString("0.00")
                            (@Model.Promotion.UnusedPushes pushes)
                        </td>
                    </tr>
                    </text>
                }
                <tr>
                    <td>
                        <span>Name</span>
                    </td>
                    <td colspan="3">
                        @Model.Promotion.Name
                    </td>
                </tr>
                <tr>
                    <td>
                        <span>Text</span>
                    </td>
                    <td colspan="3">
                        @Model.Promotion.PromotionText
                    </td>
                </tr>
                <tr>
                    <td>
                        <span>Single Use Only</span>
                    </td>
                    <td colspan="3">
                        @(Model.Promotion.SingleUseOnly?"Yes":"No")
                    </td>
                </tr>
                <tr style="display:none">
                    <td>
                        <span>Match categories</span>
                    </td>
                    <td colspan="3">
                        @Model.Promotion.Match
                    </td>
                </tr>
                <tr>
                    <td>
                        <span>Status:</span>
                    </td>
                    <td>
                        <strong>
                            @if (Model.Promotion.Status == Zatify.Domain.Data.PromotionStatus.Active)
                            {
                                <text>Active</text>
                            }
                            else if (@Model.Promotion.Status == Zatify.Domain.Data.PromotionStatus.Complete)
                            { 
                                <text>Complete</text>
                            }
                            else if (@Model.Promotion.Status == Zatify.Domain.Data.PromotionStatus.Pending)
                            {
                                <text>Pending</text>
                            }
                        </strong>
                    </td>
                    <td colspan="2">
                        <span>Billing ref:</span>
                        Promotion @Model.Promotion.PromotionNumber.ToString()
                    </td>
                </tr>
            </tbody>
        </table>
        <div class="picture_coupon_img">
            @* <img alt="" src="images/coupon_img.jpg">*@
            <img alt="" src="@Url.Action("GetPromotionPicture", new { id = Model.Promotion.PromotionId, w = 150, h = 170 })" />
        </div>
        @if (Model.Promotion.Status == Zatify.Domain.Data.PromotionStatus.Active)
        {
            <text> <a href="@Url.Action("Stop", new { id = Model.Promotion.PromotionId })" onclick="return confirm('Are you sure you want to stop this promotion?');">
                <input type="submit" value="Stop" class="blue_btn" style="margin-left: 0px;" />
            </a><a href="@Url.Action("AddTime", new { id = Model.Promotion.PromotionId })">
                <input type="submit" value="Add Time" class="blue_btn" style="margin-left: 0px;" />
            </a><a href="@Url.Action("AddBudget", new { id = Model.Promotion.PromotionId })">
                <input type="submit" value="Add Budget" class="blue_btn" style="margin-left: 0px;" />
            </a>
            </text>
        }
        else if (@Model.Promotion.Status == Zatify.Domain.Data.PromotionStatus.Complete)
        { 
            <text> <a href="@Url.Action("Renew", new { id = Model.Promotion.PromotionId })">
                <input type="submit" value="Renew" class="blue_btn" style="margin-left: 0px;" />
            </a><a href="@Url.Action("AddTime", new { id = Model.Promotion.PromotionId })">
                <input type="submit" value="Add Time" class="blue_btn" style="margin-left: 0px;" />
            </a><a href="@Url.Action("AddBudget", new { id = Model.Promotion.PromotionId })">
                <input type="submit" value="Add Budget" class="blue_btn" style="margin-left: 0px;" />
            </a>
            </text>
        }
        else if (@Model.Promotion.Status == Zatify.Domain.Data.PromotionStatus.Pending)
        {
            <text> <a href="@Url.Action("Edit", new { promotionId = Model.Promotion.PromotionId })">
                <input type="submit" value="Edit" class="blue_btn" style="margin-left: 0px;" />
            </a><a href="@Url.Action("Delete", new { id = Model.Promotion.PromotionId })" onclick="return confirm('Are you sure you want delete this promotion?');">
                <input type="submit" value="Delete" class="blue_btn" style="margin-left: 0px;" />
            </a>
            </text>
        }
    </div>
    <div class="clearfix">
    </div>
</div>
